<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <style>
    *{
      margin: 0;
      padding: 0;
      list-style: none;
      text-decoration: none;
      vertical-align: middle;
    }
    .box{
      width: 790px;
      height: 340px;
      margin: 20px auto;
      position: relative;
    }
    li{
      position: absolute;
      display: none;
    }
    li:first-child{
      display: block;
    }
    .btns{
      position: absolute;
      top:50%;
      transform: translateY(-50%);
      width: 100%;
    }
    span{
      display: block;
      width: 40px;
      height: 60px;
      background-color: rgba(0,0,0,0.5);
      text-align: center;
      line-height: 60px;
      color: white;
      font-size: 30px;
      font-weight: 700;
      float: left;
      display: none;
    }
    .btns span:last-child{
      float: right;
    }
    .box:hover span{
      display: block;
    }
    
  </style>
</head>
<body>
  <div class="box">
    <ul>
      <li><a href="javascript:;"><img src="images/1.jpg" alt=""></a></li>
      <li><a href="javascript:;"><img src="images/2.jpg" alt=""></a></li>
      <li><a href="javascript:;"><img src="images/3.jpg" alt=""></a></li>
      <li><a href="javascript:;"><img src="images/4.jpg" alt=""></a></li>
      <li><a href="javascript:;"><img src="images/5.jpg" alt=""></a></li>
      <li><a href="javascript:;"><img src="images/6.jpg" alt=""></a></li>
      <li><a href="javascript:;"><img src="images/7.jpg" alt=""></a></li>
      <li><a href="javascript:;"><img src="images/8.jpg" alt=""></a></li>
    </ul>
    <div class="btns">
      <span class="l_btn">&lt;</span>
      <span class="r_btn">&gt;</span>
    </div>
  </div>
  <script src="../../jquery-1.12.4.min.js"></script>
  <script>
    var index = 0;
    $('.r_btn').click(function(){
      index ++;
      console.log(index)
      if(index === $('li').length){
        index = 0;
      }
      $('li').eq(index).stop().fadeIn(1000).siblings().stop().fadeOut(1000);
    });

    $('.l_btn').click(function(){
      index --;
      console.log(index)
      if(index < 0){
        index = $('li').length - 1;
      }
      $('li').eq(index).stop().fadeIn(1000).siblings().stop().fadeOut(1000);
    })
  </script>
</body>
</html>